﻿using System;
using System.Linq;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Reflection;
using System.Collections.Generic;
using RssDataModel;
using RssDataModel.ViewModel;
using System.Xml;
using System.Xml.Linq;

namespace TestLinqtoDb
{
    public class Sample
    {
        public int x;
        public virtual void fun() { }
    }
    public class DerivedSample : Sample
    {
        new public void fun() { }
    }


    class Program
    {
        public static void Main(string[] args)
        {
            //ArticleData da = new ArticleData();
            DataClasses datamodel = new DataClasses();
            datamodel.Log = Console.Out;

            new[] { "green", "brown", "blue", "red" }.Max(c => c.Length);


            var city = new XElement("city", "Seattle");
            var customer1 = new XElement("customer", city);
            var customer2 = new XElement("customer", city);
            city.SetValue("London");
            Console.WriteLine(customer2.Element("city").Value);




            //(new EmployeeTest()).runTest();

            //(new ArticleData()).testArticle();

            //foreach (string s in (new DataAcces.ArticleData()).getSelectedSiteNamesforUser(1))
            //    Console.WriteLine(s);

            //foreach (article a in datamodel.getArticlesFromRSSFeeds())
            //{
            //    foreach (PropertyInfo pi in a.GetType().GetProperties())
            //    {
            //        Console.WriteLine("Name: {0} | Value: {1}",
            //                    pi.Name,
            //                    pi.GetValue(a, null));
            //    }
            //    Console.WriteLine("----------------\n");
            //    //Console.WriteLine(a.ID + "\n" + a.siteID + "\n" + a.Title + "\n" +
            //    //    a.Category + "\n" + a.Description + "\n" + a.Pubdate +
            //    //    "\n----------------------------------------\n");
            //}

            //List<article> al= new List<article>()
            //{   
            //    new article(){ID = 0,siteID = 1,Title = "title",Category = "category",Description = "description",Fullarticle = "fullarticle",Weblink = "weblink4",Pubdate = DateTime.Now},
            //    new article(){ID = 0,siteID = 1,Title = "title",Category = "category",Description = "description",Fullarticle = "fullarticle",Weblink = "weblink8",Pubdate = DateTime.Now},
            //    new article(){ID = 0,siteID = 1,Title = "title",Category = "category",Description = "description",Fullarticle = "fullarticle",Weblink = "weblink6",Pubdate = DateTime.Now}
            //};
            //datamodel.addArticlesToDB(al);

            //datamodel.deleteArticlesOlderThan(48);

            //foreach ( SiteSelectItem ssi in datamodel.getSitesForUser(1))
            //{
            //    foreach (PropertyInfo pi in ssi.GetType().GetProperties())
            //    {
            //        Console.WriteLine("Name: {0} | Value: {1}",
            //                    pi.Name,
            //                    pi.GetValue(ssi, null));
            //    }
            //    Console.WriteLine("----------------\n");
            //    //Console.WriteLine(a.ID + "\n" + a.siteID + "\n" + a.Title + "\n" +
            //    //    a.Category + "\n" + a.Description + "\n" + a.Pubdate +
            //    //    "\n----------------------------------------\n");
            //}

            Console.ReadLine();
        }
    }
}

